package com.bhs.sansonglogistics.ui.order;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.base.BaseActivity;
import com.bhs.sansonglogistics.base.BaseBean;
import com.bhs.sansonglogistics.net.NetCallBack;
import com.bhs.sansonglogistics.ui.home.SourceGoodsListFragment;
import com.bhs.sansonglogistics.utils.ToastUtil;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;

import okhttp3.ResponseBody;
import retrofit2.Response;

/**
 * 抢单
 */
public class PreemptActivity extends BaseActivity implements NetCallBack {


    private TextView mTvPreemptStatus;
    private Button mBtnCheckOrder;
    private Button mBtnBack;
    private ImageView mIvOrderGrabbingAnimation;
    private String deliver_sn;

    @Override
    public int initLayout() {
        return R.layout.activity_preempt;
    }

    @Override
    public void initView() {
        deliver_sn=getIntent().getStringExtra("deliver_sn");

        mTvPreemptStatus = findViewById(R.id.tv_preempt_status);
        mBtnCheckOrder = findViewById(R.id.btn_check_order);
        mBtnBack = findViewById(R.id.btn_back);
        mIvOrderGrabbingAnimation = findViewById(R.id.iv_order_grabbing_animation);
    }

    @Override
    public void initData() {
        Glide.with(mActivity).load(R.mipmap.ic_winning_order).into(mIvOrderGrabbingAnimation);
        //抢单
        networkRequest(netApi.preempt(deliver_sn), this);
    }


    @Override
    public void onResponse(int requestCode, String json, Response<ResponseBody> response) throws Exception {
        BaseBean bean=new Gson().fromJson(json,BaseBean.class);
        ToastUtil.show(bean.getMsg());
    }

    @Override
    public void onFailure(int requestCode) {

    }
}